﻿<UserControl
    x:Class="FU.Capstones.IMS.Web.Silverlight.Views.OrderDetail"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:Controls="clr-namespace:FU.Capstones.IMS.Web.Silverlight.Controls" 
    xmlns:Navigation="clr-namespace:Navigation.Silverlight;assembly=Navigation.Silverlight"
    xmlns:Groupbox="clr-namespace:Groupbox;assembly=Groupbox" 
    Navigation:ViewModel.TypeName="FU.Capstones.IMS.Web.Silverlight.ViewModels.OrderDetailViewModel" >

    <UserControl.Resources></UserControl.Resources>
    <telerik:RadBusyIndicator 
        BusyContent="Đang kết nối tới máy chủ..." 
        IsBusy="{Binding Path=ServiceCallCounter, Converter={StaticResource IntegerToBoolConverter}}">
        <Grid x:Name="LayoutRoot" Style="{StaticResource ViewGridStyle}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="Auto"/>
                 
            </Grid.RowDefinitions>

            <!--Title-->
            <Grid Grid.ColumnSpan="3" Grid.Row="0">
                <Grid.Background>
                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                        <GradientStop Color="{StaticResource OuterColor}" Offset="{StaticResource ControlBackgroundGradientStop0}"/>
                        <GradientStop Color="{StaticResource InnerColor}" Offset="{StaticResource ControlBackgroundGradientStop1}"/>
                        <GradientStop Color="{StaticResource InnerColor}" Offset="{StaticResource ControlBackgroundGradientStop2}"/>
                        <GradientStop Color="{StaticResource OuterColor}" Offset="{StaticResource ControlBackgroundGradientStop3}"/>
                    </LinearGradientBrush>
                </Grid.Background>

                <TextBlock 
                        x:Name="lblTitle"                                     
                        Text="Thông tin chi tiết đơn hàng"
                        Style="{StaticResource TextBlockTitlePageStyle}" />
            </Grid>
            <Groupbox:GroupBox Grid.Column="1" Grid.Row="2">
                <Groupbox:GroupBox.Header>
                    <TextBlock Text="Thông tin đơn hàng" Style="{StaticResource TextBlockGroupBoxTitleStyle}"/>
                </Groupbox:GroupBox.Header>
                <Grid Margin="5,2">
                    <!--Text box field-->
                    <!--<Grid x:Name="TextBoxField" Grid.Column="1" Grid.Row="2">-->
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="40"/>
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <TextBlock
                        Style="{StaticResource TextBlockNormalStyle}"
                        Grid.Column="0" Grid.Row="0">
                        <Run Text="Ngày lập đơn hàng " />
                    </TextBlock>

                    <TextBlock Text="{Binding Path=MaterialOrder.OrderDate}"
                               Grid.Column="1" Grid.Row="0"
                               Style="{StaticResource TextBlockNormalStyle}"
                               VerticalAlignment="Center"
                               Width="230"
                               HorizontalAlignment="Left">

                    </TextBlock>
                    <!--Person in charge-->
                    <TextBlock
                        Style="{StaticResource TextBlockNormalStyle}"
                        Grid.Column="0" Grid.Row="2">
                        <Run Text="Người làm hóa đơn " />
                    </TextBlock>
                   
                    <TextBlock Text="{Binding Path=MaterialOrder.EmployeeA.FullName}"
                               Grid.Column="1" Grid.Row="2"
                               Style="{StaticResource TextBlockNormalStyle}"
                               VerticalAlignment="Center"
                               Width="230"
                               HorizontalAlignment="Left">
                        
                    </TextBlock>
                    <!--Person order-->
                    <TextBlock
                        Style="{StaticResource TextBlockNormalStyle}"
                        Grid.Column="0" Grid.Row="1">
                        <Run Text="Người làm yêu cầu " />
                    </TextBlock>
                    <TextBlock Text="{Binding Path=MaterialOrder.EmployeeB.FullName}"
                               Grid.Column="1" Grid.Row="1"
                               Width="230"
                               Style="{StaticResource TextBlockNormalStyle}"
                               VerticalAlignment="Center"
                               Visibility="{Binding Path=IsInternal, Mode=TwoWay,Converter={StaticResource BoolToVisibilityConverter}}"
                               HorizontalAlignment="Left">

                    </TextBlock>
                    <TextBlock Text="{Binding Path=MaterialOrder.Contact.FullName}"
                               Grid.Column="1" Grid.Row="1"
                               Style="{StaticResource TextBlockNormalStyle}"
                               VerticalAlignment="Center"
                               Width="230"
                               Visibility="{Binding Path=IsExternal, Mode=TwoWay,Converter={StaticResource BoolToVisibilityConverter}}"
                               HorizontalAlignment="Left">

                    </TextBlock>

                    <!--Store-->
                    <TextBlock
                        Style="{StaticResource TextBlockNormalStyle}"
                        Grid.Column="0" Grid.Row="3">
                        <Run Text="Kho " />
                    </TextBlock>
                    <TextBlock Text="{Binding Path=WarehouseName}"
                               Grid.Column="1" Grid.Row="3"
                               Width="230"
                               Style="{StaticResource TextBlockNormalStyle}"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Left">

                    </TextBlock>
                    
                    <!--Kieu hoa don-->
                    <TextBlock
                        Style="{StaticResource TextBlockNormalStyle}"
                        Grid.Column="0" Grid.Row="4">
                        <Run Text="Kiểu đơn hàng " />
                    </TextBlock>
                    <TextBlock Text="{Binding Path=ImportExport}"
                               Grid.Column="1" Grid.Row="4"
                               Width="230"
                               Style="{StaticResource TextBlockNormalStyle}"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Left">

                    </TextBlock>
                    <TextBlock
                        Style="{StaticResource TextBlockNormalStyle}"
                        Grid.Column="0" Grid.Row="5">
                        <Run Text="Công nhân - khách hàng " />
                    </TextBlock>
                    <TextBlock Text="{Binding Path=WorkerContact}"
                               Grid.Column="1" Grid.Row="5"
                               Width="230"
                               Style="{StaticResource TextBlockNormalStyle}"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Left">

                    </TextBlock>
                    <Grid Grid.Column="0" Grid.Row="0">
                       

                    </Grid>
                    <Grid Grid.Column="1" Grid.Row="0">
                        
                    </Grid>
                </Grid>
            </Groupbox:GroupBox>

            <Groupbox:GroupBox Grid.Column="1" Grid.Row="3">
                <Groupbox:GroupBox.Header>
                    <TextBlock Text="Danh sách nguyên liệu\sản phẩm" Style="{StaticResource TextBlockGroupBoxTitleStyle}"/>
                </Groupbox:GroupBox.Header>
                <Grid Margin="1,2">
                    <telerikGrid:RadGridView 
                        Width="500"
                        x:Name="grvOrderMaterial"
                        HorizontalAlignment="Left"                
                        Style="{StaticResource RadGridViewNormal}"
                        ItemsSource="{Binding Path=PagedCollectionMaterial}">
                        <telerikGrid:RadGridView.Columns>

                            <telerikGrid:GridViewDataColumn 
                            DataMemberBinding="{Binding Path=MaterialCode,Mode=OneWay}"
                            TextAlignment="Center"
                            Header="Mã nguyên liệu"
                            Width="100" HeaderTextAlignment="Center">
                            </telerikGrid:GridViewDataColumn>

                            <telerikGrid:GridViewDataColumn 
                            DataMemberBinding="{Binding Path=MaterialName}"
                            Header="Tên nguyên liệu"
                            Width="150" HeaderTextAlignment="Center"
                            TextAlignment="Center">
                            </telerikGrid:GridViewDataColumn>

                            <telerikGrid:GridViewDataColumn                       
                            Header="Số lượng"
                            IsReadOnly="True"                       
                            Width="80" HeaderTextAlignment="Center" 
                            TextAlignment="Center"                                                 
                            DataMemberBinding="{Binding Path=Quantity}">
                            </telerikGrid:GridViewDataColumn>

                            <telerikGrid:GridViewDataColumn                       
                            Header="Đơn giá"
                            Width="100" HeaderTextAlignment="Center"    
                            TextAlignment="Right"
                            DataMemberBinding="{Binding Path=PricePerUnit, Mode=TwoWay,Converter={StaticResource DecimalToVnCurrencyConverter}}">
                            </telerikGrid:GridViewDataColumn>                            
                        </telerikGrid:RadGridView.Columns>

                    </telerikGrid:RadGridView>
                </Grid>
            </Groupbox:GroupBox>
           
            <StackPanel
                Orientation="Horizontal" HorizontalAlignment="Right"
                Grid.Column="1" Grid.Row="4">               
                <Controls:BackButtonControl
                    HorizontalAlignment="Right"
                    />
            </StackPanel>
        </Grid>
    </telerik:RadBusyIndicator>
</UserControl>
